const validator = (rules, errType) => {
  return async (ctx, next) => {
    try {
      console.log(ctx.request.body);
      await ctx.verifyParams(rules);
    } catch (err) {
      errType.result = err;
      return ctx.app.emit("error", errType, ctx);
    }
    await next();
  };
};
module.exports = { validator };
